<html> <head>
<title>A Processing.js Example</title>
<script type="text/javascript" src="../../../processing.js"></script>

</head>
<body>
<table width="640">
<tr>
	<td>
	<h1 style="background: lightgreen;">A Processing.js 3D rotate() Example</h1>
	
	<script type="application/processing">
	void setup()
{
  size(200,200);
  noStroke();
  fill(255);
  frameRate(30);
}

float angle;
float cosine;
float jitter;

void draw()
{
  background(102);
  
  if(second()%2 == 0){
    jitter = (random(-0.1, 0.1));
  }
  angle = angle + jitter;
  cosine = cos(angle);
  
  translate(width/2, height/2);
  rotate(cosine);
  rectMode(CENTER);
  rect(0, 0, 115, 115);   
}
	</script><canvas width="500" height="500" ></canvas>
	
	<div id="debug"></div>
	</td>
	
</tr>
</body> </html>
